﻿<Window ResxExtension.DefaultResxName="MuddyBoots.GreenlightQC.Mobile.UI.View.MainWindow" Language="{UICulture}"
        x:Class="MuddyBoots.GreenlightQC.Mobile.UI.View.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:v="clr-namespace:MuddyBoots.GreenlightQC.Mobile.UI.View"
        xmlns:vm="clr-namespace:MuddyBoots.GreenlightQC.Mobile.UI.ViewModel"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        Title="{Resx AppTitle}" Height="700" Width="1000"
        DataContext="{Binding MainWindowViewModel, Source={StaticResource Locator}}">

    <Window.Resources>
        <DataTemplate DataType="{x:Type vm:AssessmentHeaderViewModel}">
            <v:AssessmentHeaderView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:MainWindowViewModel}">
            <v:MainWindow />
        </DataTemplate>
    </Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200" />
            <ColumnDefinition Width="2" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Menu x:Name="menu"              
              Grid.Row="0" Grid.ColumnSpan="3"
              FontFamily="{DynamicResource ContentFontFamily}"
              FontSize="{DynamicResource DefaultFontSize}"
              VerticalAlignment="Top"
              Height="28"
              Background="{StaticResource NavigationBarBackgroundColourBrush}"
              VerticalContentAlignment="Center">
            <MenuItem Name="fileMenu"
                      Header="{Resx fileMenu}"                     
                      Padding="7,6,8,3"
                      Margin="0,1,0,0">
                <MenuItem Header="{Resx fileMenuExit}"
                          InputGestureText="Alt+F4"
                          Click="HandleExit" />
            </MenuItem>
            <MenuItem Name="languagesMenu"
                      Header="{Resx languageMenu}"
                      Padding="7,6,8,3"
                      Margin="0,1,0,0">
                <MenuItem Name="languageMenuEnglish"
                          Header="{Resx languageMenuEnglish}"
                          InputGestureText="F1"
                          Click="HandleEnglish" />
                <MenuItem Name="languageMenuFrench"
                          Header="{Resx languageMenuFrench}"
                          InputGestureText="F2"
                          Click="HandleFrench" />
                <MenuItem Name="languageMenuGerman"
                          Header="{Resx languageMenuGerman}"
                          InputGestureText="F3"
                          Click="HandleGerman" />
            </MenuItem>
        </Menu>

        <DockPanel Grid.Row="1"  Grid.ColumnSpan="3"
            Height="100" HorizontalAlignment="Left" Width="Auto">
            <Image Source="/MuddyBoots.GreenlightQC.Mobile.UI;component/Assets/GLQCLogo.png"/>
        </DockPanel>

        <DockPanel Grid.Row="1"  Grid.ColumnSpan="3"
                   Height="100" HorizontalAlignment="Right" Width="Auto">
            <Image Source="/MuddyBoots.GreenlightQC.Mobile.UI;component/Assets/MBSLogo.png"/>
        </DockPanel>

        <DockPanel Grid.Row="1"  Grid.ColumnSpan="3"
                   VerticalAlignment="Bottom">
            <Border BorderBrush="{StaticResource ColouredBackgroundControlColourBrush}" BorderThickness="2" />
        </DockPanel>

        <ListBox Grid.Column="0" Grid.Row="2" HorizontalAlignment="Stretch">
            <ItemsControl ItemsSource="{Binding SubMenu, Mode=OneWay}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Button Width="180" Height="25" Content="{Binding Text}" 
                                Background="Transparent"
                                BorderThickness="0"
                                Command="{Binding DataContext.LoadAssessmentCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
                                CommandParameter="{Binding TargetIdentifier}" HorizontalContentAlignment="Left" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ListBox>

        <GridSplitter Grid.Column="1" Grid.Row="2" HorizontalAlignment="Stretch" />

        <ContentControl Grid.Column="2" Grid.Row="2" Content="{Binding Path=CurrentViewModel, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" HorizontalAlignment="Stretch" Margin="0,0,0,60" />

        <DockPanel Grid.Row="2"  Grid.ColumnSpan="3" VerticalAlignment="Bottom">
            <StackPanel Orientation="Vertical">
                <Border DockPanel.Dock="Bottom" Height="40" Background="{StaticResource NavigationBarBackgroundColourBrush}">
                    <StackPanel Orientation="Horizontal" x:Name="NavigationPanel">
                        <ToggleButton Tag="Navigation" Content="{Resx assessments}" Style="{StaticResource NavigationButtonStyle}" Click="OnNavigationClick" Command="{Binding ShowAssessmentsCommand}" IsEnabled="{Binding IsLoggedIn}" />
                        <ToggleButton Tag="Navigation" Content="{Resx correctiveActions}" Style="{StaticResource NavigationButtonStyle}" Click="OnNavigationClick" Command="{Binding ShowCorrectiveActionsCommand}" IsEnabled="{Binding IsLoggedIn}" />
                        <ToggleButton Tag="Navigation" Content="{Resx tasks}" Style="{StaticResource NavigationButtonStyle}" Click="OnNavigationClick" Command="{Binding ShowTasksCommand}" IsEnabled="{Binding IsLoggedIn}" />
                        <ToggleButton Tag="Navigation" Content="{Resx reports}" Style="{StaticResource NavigationButtonStyle}" Click="OnNavigationClick" Command="{Binding ShowReportsCommand}" IsEnabled="{Binding IsLoggedIn}" />
                        <ToggleButton Tag="Navigation" Content="{Resx sync}" Style="{StaticResource NavigationButtonStyle}" Click="OnNavigationClick" Command="{Binding ShowSyncroniseCommand}" IsEnabled="{Binding IsLoggedIn}" />
                    </StackPanel>
                </Border>
                <StatusBar Height="20" Background="{StaticResource ColouredBackgroundControlColourBrush}" />
            </StackPanel>
        </DockPanel>

    </Grid>
</Window>
